<template>
	<view class="head-notice f-r-b">
		<uni-icons type="notification-filled" size="20" :color="themeColor" ></uni-icons>
		<view class="notice f-r-s">
			<view class="message ">{{newsTitle}}</view>
		</view>
		<view class="notice-btn f-r-e " @click="toMessage">
			<text :style="{'color':themeColor}">查看更多</text>
			<uni-icons type="right" size="14" :color="themeColor"></uni-icons>
		</view>
	</view>
</template>

<script>
	export default{
		props:['themeColor',],
		data(){
			return{
				newsTitle:'',
				newsContent:'',
			}
		},
		onReady() {
			this.getMessage();
		},
		methods:{
			getMessage(){
				let opts={
				    url:'/market/getOneInform',
				    method: 'get'
				};
				this.$http(opts,{}).then(res=>{
					this.newsTitle=res.data.newsTitle;
					this.newsContent=res.data.newsContent;
				})
			},
			toMessage(){
				uni.navigateTo({
					url:'/pages/index/message?newsTitle='+this.newsTitle+'&newsContent='+this.newsContent,
				})
			},
		}
	}
</script>

<style lang="less" scoped>
	.head-notice{
		background: #ff000009;
		padding:0 10rpx ;
		height: 70rpx;
		border-radius: 10rpx;
		
		@keyframes scroll-left {
		  0% { transform: translateX(100%); }
		  100% { transform: translateX(-100%);}
		}
		.notice{
			flex: 1;
			margin: 0 10rpx;
			// width: 460rpx;
			height: 70rpx;
			overflow: hidden;
			white-space: nowrap;
			position: relative;
			top: 0;
			.message {
			  width: 100%;
			  animation: scroll-left 8s linear infinite;
			  position: absolute;
			  right: 0;
			  color: #000;
			  font-size: 26rpx;
			}
		}
		
		.notice-btn{
			width: 160rpx;
			text-align: right;
			font-size: 26rpx;
			
			
		}
	}
</style>